package com.servlet.test;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/register")
public class RegisServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        req.getRequestDispatcher("");
    }

    @Override
    protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String username = req.getParameter("username1");
        String password = req.getParameter("password2");
        String password2 = req.getParameter("password3");

        if (username != null && password != null && password.equals(password2)) {
            System.out.println("注册成功");
        } else {
            System.out.println("注册失败");
        }
    }

    protected static String[] login(HttpServletRequest req){
        String username = req.getParameter("username1");
        String password = req.getParameter("password2");
        return  new String[]{username,password};
    }
}
